package com.paic.custserv.domain;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import com.paic.custserv.vo.SysMenuVO;

public class AppUser extends UserVO implements UserDetails {

	private static final long serialVersionUID = -1443512367241497644L;
	
	private Collection<GrantedAuthority> authorities;
	
	//首页菜单
	private SysMenuVO fistPageMenu;
	
	//拥有的权限
	private List<SysMenuVO> sysMenuList;
	
	//快捷菜单
	private List<SysMenuVO> quickMenuList;
	
	private Map<String, Collection<ConfigAttribute>> resourceMap;
	
	public AppUser() { }
	
	public AppUser(String userName, String password, Collection<GrantedAuthority> authorities ) {
		super.setUserName(userName);
		super.setPassword(password);
		this.authorities = authorities;
	}

	@Override
	public Collection<GrantedAuthority> getAuthorities() {
		return authorities;
	}
	
	public void setAuthoritys(Collection<GrantedAuthority> authoritys) {
		this.authorities = authoritys;
	}

	public SysMenuVO getFistPageMenu() {
		return fistPageMenu;
	}

	public void setFistPageMenu(SysMenuVO fistPageMenu) {
		this.fistPageMenu = fistPageMenu;
	}

	public List<SysMenuVO> getSysMenuList() {
		return sysMenuList;
	}

	public void setSysMenuList(List<SysMenuVO> sysMenuList) {
		this.sysMenuList = sysMenuList;
	}

	public Map<String, Collection<ConfigAttribute>> getResourceMap() {
		return resourceMap;
	}

	public void setResourceMap(Map<String, Collection<ConfigAttribute>> resourceMap) {
		this.resourceMap = resourceMap;
	}
	
	public List<SysMenuVO> getQuickMenuList() {
		return quickMenuList;
	}

	public void setQuickMenuList(List<SysMenuVO> quickMenuList) {
		this.quickMenuList = quickMenuList;
	}

	@Override
	public String getPassword() {
		return super.getPassword();
	}

	@Override
	public String getUsername() {
		return super.getUserName();
	}

	@Override
	public boolean isAccountNonExpired() {
		return true;
	}

	@Override
	public boolean isAccountNonLocked() {
		return true;
	}

	@Override
	public boolean isCredentialsNonExpired() {
		return true;
	}

	@Override
	public boolean isEnabled() {
		return true;
	}

}
